package Robot;
import Controllers.Controller;
import javaclient2.*;

public class Robot {
    
    private String name;
    private static int numRobots=0;
    private int idRobot;
    private String ip;
    private int port;
    private PlayerClient connection;

    public static final float width = 0.2f;
    public static final float height = 0.2f;
    public static final float radius = 0.1f;


    
    public Robot(String ip, int port, PlayerClient main,String name, int index) {
        this.ip=ip;
        this.port=port;
        this.name=name;
        idRobot=index;//numRobots;
        numRobots++;
        connection=main;
    }
    
    public Robot(String ip, int port,String name,int index) {
        this.ip=ip;
        this.port=port;
        
        this.name=name;
        idRobot=index;//numRobots;
        numRobots++;
        connection = new PlayerClient(ip, port);
        //connection.requestDataDeliveryMode(connection.PLAYER_DATAMODE_PULL);
        //connection.requestAddReplaceRule(-1, -1,  connection.PLAYER_MSGTYPE_DATA, -1, 1);
        
        //connection.runThreaded(-1,-1);
    }
    
    /*
        Constructor for virtual Robots
     
     */
    public Robot(String name,int index){
        this.idRobot=index;
        this.name=name;
        port=-1;
        connection=null;
        ip=null;
        
    
    }

    public void runThreaded(long millis, int nanos){
        this.connection.runThreaded(millis,nanos);
    }
    
    public String getIp() {
        return ip;
    }

    public void setIp(String val) {
        this.ip = val;
    }

    public int getId() {
        return idRobot;
    }

    public void setId(int val) {
        this.idRobot = val;
    }


    public int getPort() {
        return port;
    }

    public void setPort(int val) {
        this.port = val;
    }

    public PlayerClient getConnection() {
        return connection;
    }

    public void setConnection(PlayerClient val) {
        this.connection = val;
    }
}
